﻿<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:UI="clr-namespace:Mengsk.Device.Devices.UI;assembly=Mengsk.Device" x:Class="Mengsk.Device.Test.MainWindow"
        Title="设备测试工具" Height="350" Width="660"  MinHeight="400" Loaded="Window_Loaded" Unloaded="Window_Unloaded">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="150"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <ListBox Grid.Column="0" x:Name="lstDeviceTypes" Margin="3" MouseDoubleClick="lstDeviceTypes_MouseDoubleClick" />
        <ListBox Grid.Column="2" x:Name="lstDevices" Margin="3">
            <ListBox.ItemContainerStyle>
                <Style TargetType="ListBoxItem">
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate>
                                <GroupBox Header="{Binding Type}">
                                    <StackPanel Orientation="Horizontal" Margin="5">
                                        <ComboBox Name="cbbDeviceTypes" ItemsSource="{Binding AvalibleTypeInfos}" DisplayMemberPath="Name" SelectionChanged="cbbDeviceTypes_SelectionChanged" Width="100" VerticalAlignment="Center" Margin="3"/>
                                        <TextBox Name="tbReadableValue" Text="{Binding ReadableValue}" IsReadOnly="True" Width="160" VerticalAlignment="Center" Margin="3"/>
                                        <Button Name="btnSetting" DataContext="{Binding}" VerticalAlignment="Center" Margin="3" Content="S" Width="40" Click="btnSetting_Click"/>
                                        <Button Name="btnTest" DataContext="{Binding}" VerticalAlignment="Center" Margin="3" Content="T" Width="40" Click="btnTest_Click"/>
                                        <Button Name="btnATest" DataContext="{Binding}" VerticalAlignment="Center" Margin="3" Content="AT" Width="40" Click="btnATest_Click"/>
                                        <Button Name="btnDelete" DataContext="{Binding}" VerticalAlignment="Center" Margin="3" Content="X" Width="40" Click="btnDelete_Click"/>
                                    </StackPanel>
                                </GroupBox>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </ListBox.ItemContainerStyle>
        </ListBox>
    </Grid>
</Window>
